{% extends "movies/default_template.html" %}

{% block title %}
	NMJ - Update NMJ
{% endblock %}

{% block content %}

	
	Last update : <br/>
	<ul id="steps">
	{% for step in last_update %}
		<li>{{ step }}</li>
	{% endfor %}
	</ul>
	<br/><br/>
	<a href="/update/start">Start an update</a>
	
	<script>
		function update_steps(){
			var bodyContent = $.ajax({
				url: "/update/status",
				global: false,
				type: "GET",
				async:false,
			}).responseText;
			$("#steps").empty();
			var splittedContent = bodyContent.split("\n")
			for (var i=0; i<splittedContent.length; i++) {
				if (splittedContent[i]) {
					$("#steps").append('<li>' + splittedContent[i] + '</li>');
				}
			}
			setTimeout("update_steps()",500);
		}
	
		$(document).ready(function(){
			setTimeout("update_steps()",500);
		})
	</script>

{% endblock %}